package com.xuecheng.manage_cms.controller;

import com.xuecheng.api.cms.CmsConfigControllerApi;
import com.xuecheng.framework.domain.cms.CmsConfig;
import com.xuecheng.framework.model.response.ResponseResult;
import com.xuecheng.manage_cms.service.CmsConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * cms的页面管理
 */
@RestController
@RequestMapping("/cms/config")
public class CmsConfigController implements CmsConfigControllerApi {

    @Autowired CmsConfigService cmsConfigService;

    /**
     * 新增cms页面
     * @param cmsConfig
     * @return
     */
    @Override
    @PostMapping("/add")
    public ResponseResult<CmsConfig> add(@RequestBody CmsConfig cmsConfig) {
        return null;
        //return cmsConfigService.add(cmsConfig);
    }

    /**
     * 根据id查询
     * @param id
     * @return
     */
    @Override
    @GetMapping("/get/{id}")
    public ResponseResult<CmsConfig> findById(@PathVariable("id") String id) {
        return cmsConfigService.findById(id);
    }

    /**
     * 修改
     * @param cmsConfig
     * @return
     */
    @Override
    @PutMapping("/edit")//这里使用put方法，http 方法中put表示更新
    public ResponseResult<CmsConfig> edit(@RequestBody CmsConfig cmsConfig) {
        return null;
        //return cmsConfigService.update(cmsConfig);
    }

    /**
     * 删除
     * @param id
     * @return
     */
    @Override
    @DeleteMapping("/del/{id}") //使用http的delete方法完成岗位操作
    public ResponseResult delete(@PathVariable("id") String id) {
        return null;
        //return cmsConfigService.delete(id);
    }

}
